﻿#include "FileUtils.h"
#include <fstream>
#include <sstream>
#include <stdexcept>
#include "Misc.h"

namespace Base {


	std::string FileUtils::LoadText(const std::string& fullpath) {
		std::ifstream infile(fullpath);
		if (infile.is_open()) {
			std::string result((std::istreambuf_iterator<char>(infile)), std::istreambuf_iterator<char>());
			infile.close();
			return result;
		}
		else {
			std::stringstream ss;
			ss << "load file:" << fullpath << " failed!";
			Debug::ThrowOrMessageBox(ss.str());
		}
	}
}